package indi.kider.server.bill.mapper;

import indi.kider.common.model.apabus.Rent;
import indi.kider.common.model.bill.*;
import indi.kider.server.bill.model.BillInfoModel;
import org.apache.ibatis.annotations.Param;
import tk.mybatis.mapper.common.Mapper;

import java.util.List;
import java.util.Map;

public interface BillMapper extends Mapper<Bill> {

    int insertOrUpdateSelective(Bill bill);

    List<RentBill> getRentBill(RentBill rentBill);

    List<RentBill> getRentBillByHouse(RentBill rentBill);

    List<RentBill> getRentBillByTenant(RentBill rentBill);

    List<RentBill> queryDayBillByRentId(RentBill rentBill);

    RentBill queryDayBillSumByRentId(RentBill rentBill);

    /**
     * 公寓管理员获取租客缴费信息及租房信息
     *
     * @param query
     * @return
     */

    List<Rent> getEnterpriseRentInfo(RentBillCountQuery query);

    List<Bill> getEnterpriseBills(RentBillCountQuery query);

    List<BillMonthReport> getEmployeeBillCount(EmployeeBillCountQuery query);

    BillMonthReport getMonthBaseExceptBill(EmployeeBillCountQuery query);

    List<Map<String, Object>> getHomePageCnt(EmployeeBillCountQuery query);


    /**
     * 查询房间所有账单
     *
     * @param query
     * @return
     */
    List<Bill> getBillListByHouseId(HousesBillQuery query);

    /**
     * 获取租客所有已租未租总计
     *
     * @param rentId
     * @return
     */
    TenantBillFinalCount getTenantBillFinalCount(@Param("rentId") Long rentId);

    /**
     * 按类别、时间统计账单支付总额
     */
    List<BillCountByTypeModel> getBillCountByTypeModelList(BillCountByTypeQuery query);

    /**
     * 查询月账单为预付费的账单进行代扣的
     *
     * @return
     */
    List<Bill> getAllOnlineBill();

    List<BillInfoModel> getRootBillMode(@Param("roomCode")String roomCode, @Param("billmonth")String billmonth);

    List<BillInfoModel> getOwnUnpayBillMode(@Param("rentId")Long rentId);

    List<BillInfoModel> getOwnUnpayBillModeDetail(@Param("rentId")Long rentId);
}